# Contributor: Bartłomiej Piotrowski <bpiotrowski@alpinelinux.org>
# Maintainer: André Klitzing <aklitzing@gmail.com>
pkgname=arch-install-scripts
pkgver=28
pkgrel=0
pkgdesc="Scripts to aid in installing Arch Linux"
arch="noarch"
url="https://github.com/archlinux/arch-install-scripts"
license="GPL-2.0-only"
depends="bash coreutils pacman util-linux-misc"
makedepends="m4 asciidoc"
subpackages="
	$pkgname-doc
	$pkgname-zsh-completion:zshcomp:noarch
	$pkgname-bash-completion:bashcomp:noarch
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/archlinux/arch-install-scripts/archive/refs/tags/v$pkgver.tar.gz"

build() {
	make
}

check() {
	make check
}

package() {
	make PREFIX=/usr DESTDIR="$pkgdir" install
}

bashcomp() {
	depends=""
	pkgdesc="Bash completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	mkdir -p "$subpkgdir"/usr/share/bash-completion
	mv "$pkgdir"/usr/share/bash-completion/completions \
		"$subpkgdir"/usr/share/bash-completion
}

zshcomp() {
	depends=""
	pkgdesc="Zsh compltions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel zsh"

	mkdir -p "$subpkgdir"/usr/share/zsh
	mv "$pkgdir"/usr/share/zsh/site-functions \
		"$subpkgdir"/usr/share/zsh
}

sha512sums="
09a027b04b70e01ccd1fd82e3a443c876bdf978b94a922de9dea4dbc187360460ea35720816724b72fc31b02338b11bf39b47ec9156518a8a3ade000530bf1df  arch-install-scripts-28.tar.gz
"
